package com.chaoyong.higo.activity;

import java.util.List;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.chaoyong.higo.R;
import com.chaoyong.higo.base.BaseActivity;
import com.chaoyong.higo.utils.V;
import com.chaoyong.higo.view.MyViewPager;

public class GuideActivity extends BaseActivity {
	@Override
	public int layoutResID() {
		// TODO Auto-generated method stub
		return R.layout.activity_guide;
	}
	private Context context;
	private ImageView[] imageViews;
	private MyViewPager guide_mViewPager;
	private View item ;
	private ImageView item_view;
	private ImageView imageView;
	private LayoutInflater inflater;
	private List<View> views;
	@Override
	public void findView() {
		// TODO Auto-generated method stub
//		inflater=LayoutInflater.from(context);
		guide_mViewPager=V.f(this, R.id.guide_mViewPager);
	}

	@Override
	public void init() {
		// TODO Auto-generated method stub
		context=this;
//		for (int i = 0; i < imageViews.length; i++) {
//			item = inflater.inflate(R.layout.item_image, null);
//			views.add(item);
//		}
//		imageViews = new ImageView[list.size()];
//		for (int i = 0; i < imageViews.length; i++) {
//			imageView = new ImageView(this);
//			LinearLayout.LayoutParams layout_params = new LinearLayout.LayoutParams(
//					15, 15);
//			layout_params.setMargins(4, 10, 4, 10);
//			imageView.setLayoutParams(layout_params);
//			imageView.setPadding(5, 5, 5, 5);
//			
//			imageViews[i] = imageView;
//			
//			if (i == 0) {
//				imageViews[i].setBackgroundResource(R.drawable.cricle_blue);
//			} else {
//				imageViews[i].setBackgroundResource(R.drawable.cricle_white);
//			}
//			linear_content.addView(imageViews[i]);
//		}
//		guide_mViewPager.setAdapter(new imageAdapter(views));
//		guide_mViewPager.setOnPageChangeListener(new ImageListener());
	}
	class imageAdapter extends PagerAdapter
	{
		private List<View> lists;
		public imageAdapter(List<View> lists) {
			super();
			this.lists = lists;
		}
		@Override
		public int getCount() {
			// TODO Auto-generated method stub
			return lists.size();
		}
		@Override
		public Object instantiateItem(ViewGroup container, int position) {
			// TODO Auto-generated method stub
			View view=lists.get(position);
			item_view=(ImageView) view.findViewById(R.id.item_view);
			
//			BitmapUtils bitmapUtils = new BitmapUtils(context);
//			// 加载网络图片
//			bitmapUtils.display(item_view,list.get(position).toString());
//            container.addView(lists.get(position));
            
//			return lists.get(position);
			return null;
		}

		@Override
		public boolean isViewFromObject(View arg0, Object arg1) {
			// TODO Auto-generated method stub
			return false;
		}

		
	}
	class ImageListener implements OnPageChangeListener
	{

		public void onPageScrollStateChanged(int arg0) {
			// TODO Auto-generated method stub
			
		}

		public void onPageScrolled(int arg0, float arg1, int arg2) {
			// TODO Auto-generated method stub
			
		}

		public void onPageSelected(int arg0) {
			// TODO Auto-generated method stub
//			what.getAndSet(arg0);
		}
		
	}
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		
	}

}
